<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateCheckDayOverviewTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('check_day_overview', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('date')->default(0)->comment('日期YMD');
            $table->unsignedInteger('totalNum')->default(0)->comment('数量合计');
            $table->unsignedInteger('commonNum')->default(0)->comment('正常订单数量');
            $table->unsignedInteger('errorNum')->default(0)->comment('异常订单数量');
            $table->unsignedInteger('auditNum')->default(0)->comment('待审核订单数量');
            $table->unsignedInteger('orderPrice')->default(0)->comment('订单金额');
            $table->unsignedInteger('tradePrice')->default(0)->comment('交易金额');
            $table->unsignedInteger('incomePrice')->default(0)->comment('入账金额');
            $table->unsignedInteger('feePrice')->default(0)->comment('手续费');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');

            $table->index('date', 'idxDate');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '对账 - 每日概览';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('check_day_overview');
    }
}
